package com.tianze.library.base;

import android.support.design.widget.TabLayout;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;

import com.tianze.library.R;

import butterknife.ButterKnife;

/**
 * Created by kingtami.
 */
public abstract class BaseViewPagerFragment extends BaseFragment {

    protected TabLayout tabLayout;
    protected ViewPager viewPager;

    protected PagerAdapter mAdapter;

    protected abstract PagerAdapter getAdapter();

    @Override
    protected int getLayoutId() {
        return R.layout.tiza_fragment_viewpager;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView() {
        tabLayout = ButterKnife.findById(rootView, R.id.tab_layout);
        viewPager = ButterKnife.findById(rootView, R.id.view_pager);
        mAdapter = getAdapter();
        viewPager.setAdapter(mAdapter);
        tabLayout.setupWithViewPager(viewPager);
    }

}
